from tkinter import*
def ser():
    r1=int(u1.get())
    r2=int(u2.get())
    r3=int(u3.get())
    r4=int(u4.get())
    rs=r1+r2+r3+r4
    trs=Label(p,text='Otpor je '+str(rs)+' oma',font=14)
    trs.place(x=110,y=133)
def par():
    r1=int(u1.get())
    r2=int(u2.get())
    r3=int(u3.get())
    r4=int(u4.get())
    zp=1/r1+1/r2+1/r3+1/r4
    rp=round(1/zp,4)
    trp=Label(p,text='Otpor je '+str(rp)+' oma',font=14)
    trp.place(x=110,y=173)    
p=Tk()
p.config(width=310,height=220)
t=Label(p,text='UKUPAN OTPOR STRUJNOG KRUGA', font=14)
t.place(x=15,y=20)
t1=Label(p,text='OTPORNICI')
t1.place(x=120,y=50)

tr1=Label(p,text='R1')
tr1.place(x=45,y=70)

tr2=Label(p,text='R2')
tr2.place(x=110,y=70)

tr3=Label(p,text='R3')
tr3.place(x=180,y=70)

tr4=Label(p,text='R4')
tr4.place(x=250,y=70)

u1=Entry(p)
u1.place(x=30,y=90,width=40)

u2=Entry(p)
u2.place(x=100,y=90,width=40)

u3=Entry(p)
u3.place(x=170,y=90,width=40)

u4=Entry(p)
u4.place(x=240,y=90,width=40)

g1=Button(p,text='Serijski',command=ser)
g1.place(x=20,y=130,width=70)
g2=Button(p,text='Paralelni', command=par)
g2.place(x=20,y=170,width=70)
p.mainloop()
